const Koa = require('koa');
const app = require('http').Server(Koa);
const io = require('socket.io')(app);

io.on('connection', function(socket){
  console.log('a user connected');
  
  socket.on('message',function(str){
    console.log("says:"+ str);
    socket.emit('welcome','hello world');
    
  })
});

app.listen(3000, function(){
  console.log('listening on *:3000');
});